﻿using System;
using System.Data.SqlClient;
using Devv.Core.UniDataTier;

namespace Yglu.BusinessLayer.Reports
{
	public class StoreOrders : BaseReport
	{
		#region Properties

		public String StoreTitle { get; set; }
		public Double TotalPrice { get; set; }
		public Double Discount { get; set; }
		public Int32 OrderCount { get; set; }
		public Int32 ComboCount { get; set; }
		public String TopSellerName { get; set; }
		public String MostSoldProductTitle { get; set; }

		public Double PriceWithDiscount
		{
			get
			{
				return TotalPrice - Discount;
			}
		}

		#endregion

		#region Constructor

		public StoreOrders()
		{
		}

		public StoreOrders(SqlDataReader reader)
		{
			Construct(reader);
		}

		#endregion

		#region Methods

		public override void Load(SqlDataReader reader)
		{
			DateGenerated = DateTime.Now;

			StoreTitle = DataHandler.GetString(reader, "StoreTitle");
            TotalPrice = DataHandler.GetDouble(reader, "TotalPrice");
			Discount = DataHandler.GetDouble(reader, "Discount");
			OrderCount = DataHandler.GetInt32(reader, "OrderCount");
			ComboCount = DataHandler.GetInt32(reader, "ComboCount");
			TopSellerName = DataHandler.GetString(reader, "TopSellerName");
			MostSoldProductTitle = DataHandler.GetString(reader, "MostSoldProductTitle");
		}

		#endregion
	}
}